package com.sinovatech.ologger.actionlog.core;

import java.lang.reflect.Method;

import org.springframework.context.ApplicationContext;

import com.sinovatech.ologger.actionlog.entity.OperationLog;

/**
 * 记录操作日志方法的参数
 */
public class OperationLogInvocation {

	public static final int RETURN_SUCCESS = 1;
	public static final int RETURN_FAIL = 0;
	
	/**
	 * 操作日志对象
	 */
	private OperationLog operationLog; 
	/**
	 * 拦截目标方法的返回值
	 */
	private Object returnValue; 
	/**
	 * 目标方法
	 */
	private Method method; 
	/**
	 * 目标方法的参数
	 */
	private Object[] args; 
	/**
	 * 目标对象
	 */
	private Object target; 
	/**
	 * Spring上下文(如果处理类(this)不是spring管理类,可通过其获取服务类)
	 */
	private ApplicationContext context;
	
	/**
	 * 目标方法是否已经执行完成
	 */
	private Boolean isExecuted = false;
	
	public OperationLogInvocation(Object returnValue, Method method, Object[] args, Object target, OperationLog operationLog, ApplicationContext context) {
		super();
		this.returnValue = returnValue;
		this.method = method;
		this.args = args;
		this.target = target;
		this.operationLog = operationLog;
		this.context = context;
	}
	
	public OperationLogInvocation() {
		super();
	}

	public Object getReturnValue() {
		return returnValue;
	}
	public void setReturnValue(Object returnValue) {
		this.returnValue = returnValue;
	}
	public Method getMethod() {
		return method;
	}
	public void setMethod(Method method) {
		this.method = method;
	}
	public Object[] getArgs() {
		return args;
	}
	public void setArgs(Object[] args) {
		this.args = args;
	}
	public Object getTarget() {
		return target;
	}
	public void setTarget(Object target) {
		this.target = target;
	}
	public OperationLog getOperationLog() {
		return operationLog;
	}
	public void setOperationLog(OperationLog operationLog) {
		this.operationLog = operationLog;
	}
	public ApplicationContext getContext() {
		return context;
	}
	public void setContext(ApplicationContext context) {
		this.context = context;
	}
	public Boolean getIsExecuted() {
		return isExecuted;
	}
	public void setIsExecuted(Boolean isExecuted) {
		this.isExecuted = isExecuted;
	}
}
